package com.zian.domain.po;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;


import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;


import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.zian.enums.IsDeletedEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author
 * @since 2024-09-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "sys_goods_category", autoResultMap = true) // autoResultMap 开启深度自动映射
@ApiModel("SysGoodsCategory对象")
public class SysGoodsCategory implements Serializable {


    private static final long serialVersionUID = 1L;

    @ApiModelProperty("分类id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;


    @ApiModelProperty("父分类id")
    private Long parentId;

    @ApiModelProperty("分类层级")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<Integer> ancestors;

    @ApiModelProperty("分类名称")
    private String categoryName;

    @ApiModelProperty("图标")
    private String icon;

    @ApiModelProperty("排序值(字段越大越靠前)")
    private Integer categoryRank = 0;

    @ApiModelProperty("删除标识字段(0-未删除 1-已删除)")
    @TableLogic
    private IsDeletedEnum isDeleted = IsDeletedEnum.NO;

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty("创建者id")
    private Long createUser;

    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @ApiModelProperty("修改者id")
    private Long updateUser;


}
